using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using WP.Modules;
using WP.Commons;
namespace MaxLeaf
{
	/// <summary>
	/// Summary description for frmSplash.
	/// </summary>
	public class frmSplash : System.Windows.Forms.Form
    {
		private System.Windows.Forms.Label lblVersion;
		private System.Windows.Forms.Label lblWarning;
		private System.Windows.Forms.Label lblCopyRight;
		private System.Windows.Forms.Label lblUserComp;
		private System.Windows.Forms.Label lblUser;
        private System.Windows.Forms.Label lblLicensed;
		private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.PictureBox picWoodpro;
        private Timer timer1;
        private IContainer components;

		public frmSplash()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
            //
            string userRoot = "HKEY_LOCAL_MACHINE";
            string subkey = "SOFTWARE\\WoodPro Software Inc.\\" + (Application.StartupPath.IndexOf("NuPro", StringComparison.CurrentCultureIgnoreCase) > 0 ? "NuProVisions" : "WoodProInsight");
            string keyName = userRoot + "\\" + subkey;
            object objKeyValue = Microsoft.Win32.Registry.GetValue(keyName, "COMPANYNAME", "");
            if (objKeyValue == null)
            {
                subkey = "SOFTWARE\\Wow6432Node\\WoodPro Software Inc.\\" + (Application.StartupPath.IndexOf("NuPro", StringComparison.CurrentCultureIgnoreCase) > 0 ? "NuProVisions" : "WoodProInsight");
                keyName = userRoot + "\\" + subkey;
                objKeyValue = Microsoft.Win32.Registry.GetValue(keyName, "COMPANYNAME", "");
                SysVar.Is64BitOS = (objKeyValue != null);
            }

            string strCompanyName = objKeyValue ==null ?"": objKeyValue.ToString() ;
            lblUserComp.Text = strCompanyName;
            objKeyValue = Microsoft.Win32.Registry.GetValue(keyName, "USERNAME", "");
            string strUserName = objKeyValue == null ? "" : objKeyValue.ToString();
            lblUser.Text = strUserName;
            objKeyValue = Microsoft.Win32.Registry.GetValue(keyName, "VERSION", "");
            string strVersion = objKeyValue == null ? "" : objKeyValue.ToString();
            lblVersion.Text ="Ver "+ strVersion;

            objKeyValue = Microsoft.Win32.Registry.GetValue(keyName, "COMPILEDATE", "");
            string strCompileDate = objKeyValue == null ? "" : objKeyValue.ToString();
            SysVar.CurrentVersion = strVersion;
            SysVar.CurrentVersionCompileDate = strCompileDate;
            this.picWoodpro.Visible = Application.StartupPath.IndexOf("NuPro", StringComparison.CurrentCultureIgnoreCase) <= 0;
   
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}


		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            this.lblVersion = new System.Windows.Forms.Label();
            this.lblWarning = new System.Windows.Forms.Label();
            this.lblCopyRight = new System.Windows.Forms.Label();
            this.lblUserComp = new System.Windows.Forms.Label();
            this.lblUser = new System.Windows.Forms.Label();
            this.lblLicensed = new System.Windows.Forms.Label();
            this.panel1 = new System.Windows.Forms.Panel();
            this.picWoodpro = new System.Windows.Forms.PictureBox();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.picWoodpro)).BeginInit();
            this.SuspendLayout();
            // 
            // lblVersion
            // 
            this.lblVersion.BackColor = System.Drawing.Color.Transparent;
            this.lblVersion.ForeColor = System.Drawing.SystemColors.ControlText;
            this.lblVersion.Location = new System.Drawing.Point(281, 122);
            this.lblVersion.Name = "lblVersion";
            this.lblVersion.Size = new System.Drawing.Size(123, 17);
            this.lblVersion.TabIndex = 24;
            this.lblVersion.Text = "Version";
            this.lblVersion.Visible = false;
            // 
            // lblWarning
            // 
            this.lblWarning.BackColor = System.Drawing.Color.Transparent;
            this.lblWarning.Location = new System.Drawing.Point(12, 211);
            this.lblWarning.Name = "lblWarning";
            this.lblWarning.Size = new System.Drawing.Size(355, 35);
            this.lblWarning.TabIndex = 23;
            this.lblWarning.Text = "This program is protected by copyright Law as discribed in Help About.";
            this.lblWarning.Visible = false;
            // 
            // lblCopyRight
            // 
            this.lblCopyRight.BackColor = System.Drawing.Color.Transparent;
            this.lblCopyRight.Location = new System.Drawing.Point(12, 194);
            this.lblCopyRight.Name = "lblCopyRight";
            this.lblCopyRight.Size = new System.Drawing.Size(221, 17);
            this.lblCopyRight.TabIndex = 22;
            this.lblCopyRight.Text = "Copyright ?WoodPro Software Inc.";
            this.lblCopyRight.Visible = false;
            // 
            // lblUserComp
            // 
            this.lblUserComp.BackColor = System.Drawing.Color.Transparent;
            this.lblUserComp.Location = new System.Drawing.Point(12, 177);
            this.lblUserComp.Name = "lblUserComp";
            this.lblUserComp.Size = new System.Drawing.Size(333, 17);
            this.lblUserComp.TabIndex = 21;
            this.lblUserComp.Text = "User Company";
            this.lblUserComp.Visible = false;
            // 
            // lblUser
            // 
            this.lblUser.BackColor = System.Drawing.Color.Transparent;
            this.lblUser.Location = new System.Drawing.Point(12, 160);
            this.lblUser.Name = "lblUser";
            this.lblUser.Size = new System.Drawing.Size(286, 17);
            this.lblUser.TabIndex = 20;
            this.lblUser.Text = "User";
            this.lblUser.Visible = false;
            // 
            // lblLicensed
            // 
            this.lblLicensed.BackColor = System.Drawing.Color.Transparent;
            this.lblLicensed.ForeColor = System.Drawing.SystemColors.ControlText;
            this.lblLicensed.Location = new System.Drawing.Point(12, 125);
            this.lblLicensed.Name = "lblLicensed";
            this.lblLicensed.Size = new System.Drawing.Size(163, 17);
            this.lblLicensed.TabIndex = 19;
            this.lblLicensed.Text = "This Product is licensed to";
            this.lblLicensed.Visible = false;
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.panel1.Location = new System.Drawing.Point(12, 142);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(269, 1);
            this.panel1.TabIndex = 27;
            this.panel1.Visible = false;
            // 
            // picWoodpro
            // 
            this.picWoodpro.BackColor = System.Drawing.Color.Transparent;
            this.picWoodpro.Image = global::MaxLeaf.Properties.Resources.index_01;
            this.picWoodpro.Location = new System.Drawing.Point(0, 40);
            this.picWoodpro.Name = "picWoodpro";
            this.picWoodpro.Size = new System.Drawing.Size(404, 137);
            this.picWoodpro.TabIndex = 28;
            this.picWoodpro.TabStop = false;
            // 
            // timer1
            // 
            this.timer1.Interval = 2000;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // frmSplash
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.BackColor = System.Drawing.SystemColors.ControlDark;
            this.BackgroundImage = global::MaxLeaf.Properties.Resources.splash2;
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.ClientSize = new System.Drawing.Size(405, 180);
            this.Controls.Add(this.picWoodpro);
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.lblVersion);
            this.Controls.Add(this.lblWarning);
            this.Controls.Add(this.lblCopyRight);
            this.Controls.Add(this.lblUserComp);
            this.Controls.Add(this.lblUser);
            this.Controls.Add(this.lblLicensed);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "frmSplash";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "frmSplash";
            this.Load += new System.EventHandler(this.frmSplash_Load);
            this.Click += new System.EventHandler(this.frmSplash_Click);
            ((System.ComponentModel.ISupportInitialize)(this.picWoodpro)).EndInit();
            this.ResumeLayout(false);

		}
		#endregion

		#region Private Events
		private void frmSplash_Load(object sender, System.EventArgs e)
		{
			lblLicensed.Text = "This Product is licensed to";
			lblCopyRight.Text = "Copyright ?WoodPro.";
			lblWarning.Text = "This program is protected by copyright Law as described in Help About.";
            this.timer1.Start();  
		}
		#endregion

		private void ptbMain_Click(object sender, System.EventArgs e)
		{
            this.Close();
		}

		private void lblSplash_Click(object sender, System.EventArgs e)
		{
            this.Close(); 
		}


        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Close(); 
        }

        private void frmSplash_Click(object sender, EventArgs e)
        {
            this.Close(); 
        }


	}
}
